package com.qqtech.qquan.community.service;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.qqtech.core.frame.service.BaseService;
import com.qqtech.qquan.community.model.CommunityMessage;
import com.qqtech.qquan.community.model.CommunityMessageQuery;
import com.qqtech.qquan.community.model.CommunityMessageVo;

public interface CommunityMessageService extends BaseService<CommunityMessage> {
	/**
	 * 邻里动态好友优先显示数量
	 * @param query
	 * @return
	 */
	public int queryCountFriendUp(CommunityMessageQuery query);
	
	/**
	 * 后台查询列表--分页
	 * 
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<CommunityMessageVo> queryPageListAdmin(CommunityMessageQuery query, Pageable pageable);
	
	/**
	 * 邻里动态好友优先显示
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<CommunityMessageVo> queryPageFriendUp(CommunityMessageQuery query, Pageable pageable);
	
	void handleAdd(CommunityMessageVo communityMessageVo);
	/**
     * 评论数+1
     * @param id
     */
    void increaseComment(Integer id, int addCount);
    
    /**
     * 点赞数+1
     * @param id
     * @param addCount
     */
    void  increasePraise(Integer id, int addCount);
	/**
	 * pv+1
	 * 
	 * @param id
	 * @return
	 */
	int increasePv(Integer id);

	/**
	 * 先pv+1,再获取详情
	 * 
	 * @param id
	 * @return
	 */
	CommunityMessageVo handleDetail(Integer id);

	/**
	 * 隐藏
	 * 
	 * @param id
	 * @return
	 */
	int hide(Integer id);

	/**
	 * 显示
	 * 
	 * @param id
	 * @return
	 */
	int show(Integer id);
	/**
	 * 查询用户最新发布的几条动态
	 * @param userId 用户id
	 * @param some 最新条数
	 * @return
	 */
	List<CommunityMessageVo> myLastSomeMessages(Integer userId, Integer some);


	/**
	 * 根据创建用户id来统计数据
	 * @param creatorId
	 * @return
	 */
	CommunityMessageVo queryTotalCountByCreatorId(Integer creatorId);

	List<CommunityMessageVo> queryTotalCountByCreatorIds(List<Integer> creatorIds);
}